package com.wiloon.javax.tmp.itext;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA. User: wiloon Date: 9/2/12 Time: 12:20 PM
 */
public class FileHelper {


    // find out all files under one specified folder
    public static List<File> getFilesUnderFolder(String folderPath) {
        List<File> rtnList = new ArrayList<File>();
        // get file and folders under folder
        File folder = new File(folderPath);
        File[] files = folder.listFiles();
        for (File file : files) {
            if (file.isDirectory()) {
                rtnList.addAll(getFilesUnderFolder(file.getAbsolutePath()));
            } else {
                rtnList.add(file);
            }
        }
        return rtnList;
    }

}
